package cn.yza.Kotlin.`01`

/**
@author Honglixi
@create 2022-05-26 15:38
 */
enum class Color_1 {
    RED, ORANGE, YELLOW, GREEN, BLUE, INDIGO, VIOLET
}
enum class Color(val r: Int, val g: Int, val b: Int) {
    RED(255,0,0), ORANGE(255, 165, 0);
    fun rgb() = (r * 256 + g) * 256 + b
}
fun getMnemonic(color: Color) =
        when(color) {
            Color.RED -> "RED"
            Color.ORANGE -> "ORANGE"
        }
fun mix(c1: Color, c2: Color) =
        when (setOf(c1, c2)) {
            setOf(Color.RED, Color.ORANGE) -> Color.RED
            else -> throw Exception("error")
        }


fun main() {
    Color.ORANGE.rgb()
    Color.RED.rgb()
    println(getMnemonic(Color.ORANGE))
}